Expand description
Usage:
fn main() {
puffin::set_scopes_on(true); // you may want to control this with a flag
// game loop
loop {
puffin::GlobalProfiler::lock().new_frame();
{
puffin::profile_scope!("slow_code");
slow_code();
}
}
}
Re-exports§
pub use utils::clean_function_name;
pub use utils::short_file_name;
pub use utils::type_name_of;
Macros§
- Returns the name of the calling function without a long module path prefix.
- Automatically name the profiling scope based on function name.
- Conditionally profile the current function.
- Profile the current scope with the given name (unique in the parent scope).
- Profile the current scope with the given name (unique in the parent scope).
- Like
profile_scope_custom
, but only conditionally profiles the scope. - Like
profile_scope
, but only conditionally profiles the scope.
Structs§
- One frame worth of profile data, collected from many sources.
- Meta-information about a frame.
- Identifies a specific
FrameSink
when added toGlobalProfiler
. - Collect statistics for maintained frames
- A view of recent and slowest frames, used by GUIs.
- Automatically connects to
crate::GlobalProfiler
. - Singleton. Collects profiling data from multiple threads and passes them on to different
FrameSink
s. - A scope that has been merged from many different sources
- Created by the
puffin::profile*!(...)
macros. - TODO: Improve encapsulation. Parses a
Stream
of profiler data. - TODO: Improve encapsulation. Used when parsing a Stream.
- A collection of scope details containing more information about a recorded profile scope.
- Detailed information about a scope.
- A unique id for each scope and
ScopeDetails
. - TODO: Improve encapsulation. Used when parsing a Stream.
- TODO: Improve encapsulation. Stream of profiling events from one thread.
- TODO: Improve encapsulation. A
Stream
plus some info about it. - TODO: Improve encapsulation. A reference to the contents of a
StreamInfo
. - Used to identify one source of profiling data.
- Collects profiling data for one thread
- One frame worth of profile data, collected from many sources.
Enums§
- TODO: Improve encapsulation. Errors that can happen when parsing a
Stream
of profile data. - Scopes are identified by user-provided name while functions are identified by the function name.
Functions§
- Are the profiler scope macros turned on? This is
false
by default. - Report a stream of profile data from a thread to the
GlobalProfiler
singleton. This is used for internal purposes only - For the given thread, merge all scopes with the same id+data path.
- Returns a high-precision, monotonically increasing nanosecond count since unix epoch.
- Select the slowest frames, up to a certain count.
- Turn on/off the profiler macros (
profile_function
,profile_scope
etc). When off, these calls take only 1-2 ns to call (100x faster). This isfalse
by default. - Shorten a rust function name by removing the leading parts of module paths.
Type Aliases§
- An incremental monolithic counter to identify frames.
- Add these to
GlobalProfiler
withGlobalProfiler::add_sink()
. - All times are expressed as integer nanoseconds since some event.
- TODO: Improve encapsulation. Custom puffin result type.